<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="decorator" content="default" />
<%@ include file="/WEB-INF/views/include/head.jsp"%>

<link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
<script>
    /*初始方法*/
	$(function() {
	     // 下拉选框带搜索功能
	     $("#reworkCostCD,#reworkReasonCD").select2(); 
	
	})
    // 保存方法
    var saveForm = {
        s:null,
            t:null,
            save:function(s,t){
                $(t).attr("disabled",true);
                this.s=s;
                this.t=t;
                 $("#inputForm").validate({
                    submitHandler : function() {
                        var params = $("#inputForm").serialize();
                        $.post("${ctx}/order/createOrder/saveOrderRework", params, function(result) {
                            if (result == "false") {
                                $("#inputForm")[0].reset();
                                $(saveForm.t).attr("disabled",false);
                            } else {
                                // 订单返工成功！
                                layer.msg('<spring:message code="order_order_rework_success"/>', {time:1000}); 
                                window.parent.frames[0].location.href = "${ctx}/order/order/";
                                closeWin();
                                
                            }
                        }, 'json');
                    }
                }    );
                $("#inputForm").submit(); 
        }
     }    
</script>
</head>
<body>
<!--头部-->
<div class="myshop clearfix">
    <!-- 订单返工 -->
    <p class="myshoptop fl"><spring:message code="order_order_rework"/></p>
    <div class="fr">
        <div class="topBtnClose" onclick="closeWin()">
            <img src="${ctxStatic}/images/btn-close.png">
        </div>
    </div>
</div>
<div class="middle myshop_middle">

    <form id="inputForm">
        <div class="data clearfix">
            <div class="ch fl">
                <!-- 订单号 -->
                <p class="data_id"><spring:message code="order_orderNo"/></p>
                <!-- 隐藏变量 -->
                <!-- 订单ID -->
                <input name="orderId" value="${order.id}" type="hidden"/>
                <!-- 订单号 -->
                <input name="orderNO" value="${order.orderNO}" type="hidden"/>
                <p class="rtname fl">${order.orderNO}</p>
            </div>
               <div class="ch fr haveToBox">
                   <!-- 快递单号 -->
                   <p class="data_id"><spring:message code="order_expressNumber"/></p>
                    <input name="reworkExpressId" type="text" class="form-control" data-rule-required="true" data-msg-required="<spring:message code="order_input_reworkExpressId"/>">
                   <p class="haveTo">*</p>
            </div>
        </div>
        <div class="data clearfix">
            <div class="ch fl haveToBox">
                <!-- 费用负担 -->
                <p class="data_id"><spring:message code="order_expense_burden"/></p>
                <select name="reworkCostCD" id="reworkCostCD" class="form-control sex" data-rule-required="true" data-msg-required="<spring:message code="order_choose_reworkCostCD"/>">
                    <c:set value="<%=ResourcesUtil.getConfig(\"rework_cost_bear\")%>" var="reworkCostBearList"  />
                    <option value=""><spring:message code="order_please_choose"/></option>
                    <c:forEach items="${fns:getDictList(reworkCostBearList)}" var="item">
                        <option value="${item.itemCode}-${item.itemValue}">${item.itemName}</option>
                    </c:forEach>
                </select>
                <p class="haveTo">*</p>
            </div>
            <div class="ch fr haveToBox">
                <!-- 返工费用 -->
                <p class="data_id"><spring:message code="order_rework_cost"/></p>
                <input name="reworkCost" type="text" class="form-control" data-rule-required="true" data-msg-required="<spring:message code="order_input_reworkCost"/>" data-rule-min="0" data-msg-min="<spring:message code="order_input_reworkCost"/>">
                <p class="haveTo">*</p>
            </div>
        </div>
        <div class="data clearfix">
            <div class="ch fl haveToBox">
                <!-- 原因类别 -->
                <p class="data_id"><spring:message code="order_reason_type"/></p>
                <select name="reworkReasonCD" id="reworkReasonCD" class="form-control sex" data-rule-required="true" data-msg-required="<spring:message code="order_choose_reworkReasonCD"/>">
                    <c:set value="<%=ResourcesUtil.getConfig(\"rework_cost_reason\")%>" var="reworkCostReasonList" />
                    <option value=""><spring:message code="order_please_choose"/></option>
                    <c:forEach items="${fns:getDictList(reworkCostReasonList)}" var="item">
                        <option value="${item.itemCode}-${item.itemValue}">${item.itemName}</option>
                    </c:forEach>
                   </select>
                   <p class="haveTo">*</p>
            </div>
    </div>
    <div class="data clearfix">
        <!-- 描述 -->
        <p class="data_id"><spring:message code="order_remark"/>
        <span class="txtRg">(0/100)</span>
            </p>
        <div class="data_ip fl">
            <textarea name="reworkDetailed" class="dsp"></textarea>
            
        </div>
     </div>
    <div class="twobtn" style="margin-top:273px;">
        <div class="onebtn clearfix">
            <!-- 订单返工 -->
            <button class="btn save fl" onclick="saveForm.save(0)"><spring:message code="order_order_rework"/></button>
            <!-- 取消 -->
            <button class="btn gon fr" onclick="closeWin()"><spring:message code="order_cancel"/></button>
        </div>
    </div>
      </form>
</div>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/layer.js"></script>
<script src="js/layerStyle.js"></script>

<script>
    var windowH = window.innerHeight
            ||document.documentElement.clientHeight
            ||document.body.clientHeight
    $('.middle').css('height',windowH - 40);
</script>
</body>
</html>
